#ifndef PID_SFB_H
#define PID_SFB_H

#include "stdint.h"

#ifdef __cplusplus
extern "C"
{
#endif

	typedef struct
	{
		uint16_t kt_sv; 

		uint16_t P, I, D; 

		float lmn_min;	  
		float lmn_max;	  
		float sv;		  
		float pv;		  
		float out_fac;	  
		float out_offset; 
		float dead_zone;  
		int32_t out;	  

		float kp, ki, kd, dft; 

		float pv_old;
		float sv_old;
		float err_old;
		float uk;

		struct
		{
			float lmn;
			float lmn_old;
		} ppp;

		struct
		{
			float lmn;
			float lmn_old;
			float rest; 
		} iii;

		struct
		{
			float lmn;
			float lmn_old;
			float rueck, rest_diff;
		} ddd;

		struct
		{
			uint8_t b_man_on;
			uint8_t b_tun_on;
			uint8_t b_conz_on;	  
			uint8_t b_uk_init_on; 
			float conz;			  
			float man_val;		  
			float disv;			  
			float uk_init;		  
			float pfac_sp;		  
		} ctr;

		struct
		{
			uint8_t b_conz_out; 
			uint8_t b_opt_lmn;
			uint8_t b_lmn_cal_en;
			uint8_t phase;
		} st;

		float diff_sp;
		float opt_lmn;
		float eff_dlmn;
		float lmn_min_old;
		float lmn_max_old;
	} sfb_pid_type;

#ifdef __cplusplus
}
#endif

#endif 
